package org.example.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.example.entity.PsyArticle;
import org.example.mapper.PsyArticleMapper;
import org.example.service.PsyArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PsyArticleServiceImpl implements PsyArticleService {
    @Autowired
    private PsyArticleMapper psyArticleMapper;

    @Override
    public PageInfo<PsyArticle> selectLikeArticle(PsyArticle psyArticle, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<PsyArticle> list = psyArticleMapper.selectLikeArticle(psyArticle);
        PageInfo<PsyArticle> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public PsyArticle selectPsyArticleById(int id) {
        return psyArticleMapper.selectPsyArticleById(id);
    }


}
